@extends('admin.base')

@section('content')
    <div class="layui-card">
        <div class="layui-card-header layuiadmin-card-header-auto">
            <h2>添加文章</h2>
        </div>
        <div class="layui-card-body">
            <form class="layui-form" action="{{route('admin.article.store')}}" method="post">
                @include('admin.article._form')
            </form>
        </div>
    </div>
@endsection

@section('script')
    @include('admin.article._js')
    <script src="{{ asset('static/editormd/editormd.min.js') }}"></script>
    @if(config('app.locale') !== 'zh-CN')
        <script src="{{ asset('static/editormd/languages/en.js') }}"></script>
    @endif
    <script>
        var testEditor;

        $(function () {
            // You can custom @link base url.
            editormd.urls.atLinkBase = "https://github.com/";

            testEditor = editormd("md-content", {
                autoFocus: false,
                width: "100%",
                height: 720,
                toc: true,
                //atLink    : false,    // disable @link
                //emailLink : false,    // disable email address auto link
                todoList: true,
                placeholder: "{{ __('Enter article content') }}",
                toolbarAutoFixed: false,
                path: '{{ asset('static/editormd/lib') }}/',
                emoji: true,
                toolbarIcons: ['undo', 'redo', 'bold', 'del', 'italic', 'quote', 'uppercase', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'list-ul', 'list-ol', 'hr', 'link', 'reference-link', 'image', 'code', 'code-block', 'table', 'emoji', 'html-entities', 'watch', 'preview', 'search', 'fullscreen'],
                imageUpload: true,
                imageUploadURL: '{{ url('/admin/article/uploadImage') }}',
            });
        });
    </script>
@endsection
